Repository navigation
Conversation
The pi provider appended the whole prompt to argv. A chat prompt embeds the
conversation history and can grow past Linux MAX_ARG_STRLEN, so fork/exec
failed with E2BIG ("argument list too long") before the CLI started. Pi reads
the prompt from stdin when the positional argument is omitted, so route an
oversized prompt through CommandSpec.Stdin and keep short turns on argv.
Author
|
Superseded by #1115, which already implements this fix; closing to avoid duplicate work. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
With the
piexecutor, a chat turn that embeds the whole conversation appends the prompt as the last argv argument. Once the prompt grows past LinuxMAX_ARG_STRLEN(128KiB),fork/execfails withargument list too longbeforepistarts, so every later message in that conversation fails.internal/runtime/provider_agentcli.gobuilt thepiargv withargv = append(append(argv, extra...), prompt)unconditionally. Short turns are fine; long chat histories are not.Change
piprompt throughCommandSpec.Stdinand omit the positional argument.pireads the prompt from stdin when the positional argument is omitted, andStdinis already forwarded by local, Docker (-i) and conversation execution, so the launch contract is unchanged.maxArgvPromptBytes(96KiB), which leaves 32KiB of headroom underMAX_ARG_STRLEN; short turns keep the existing positional form.TestPiOversizedPromptGoesToStdin, which checks that no argv entry exceeds the limit, that stdin carries the exact prompt, and that a short turn still uses the positional argument.Other agent-CLI branches were left untouched: only
piis documented to read the prompt from stdin when the positional argument is omitted.Validation
GOOS=linux go vet ./internal/runtime/— clean.GOOS=linux go test -c ./internal/runtime/— compiles.runtime.test -test.run 'TestPiOversizedPromptGoesToStdin|TestPromptOnStdin|TestAgentCLICommandChatRestrictions' -test.v— all pass../internal/runtimesuite was also run in the same sandbox; the only failures there are environment-only (git/python3are not installed in that sandbox), and they are unrelated to this change. CI provides both tools.Fixes #1081.